package com.jdkreader.lambada;


/**
 * 函数式接口示例
 *
 */
@FunctionalInterface
public interface Converter <F,T>{

    T convert(F from);


    public static void main(String[] args) {

        //构造一个Converter接口的实现类<String,Integer>
//        Converter<String,Integer> converter = (from) ->Integer.valueOf(from);
//        Integer converted = converter.convert("123");
//        System.out.println(converted);

        Converter<String, Integer> converter = Integer::valueOf;
        Integer converted = converter.convert("123");
        System.out.println(converted);   // 123
    }
}
